charger24 2.2.1
Loading...
Searching...
No Matches
charger24


Charger 24 Click

Charger 24 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Apr 2025.
  • Type : GPIO type

Software Support

Example Description

This example demonstrates the use of the Charger 24 Click board. The application initializes the device, enables battery charging, and continuously monitors the charging and USB power status. It displays whether the battery is currently charging, fully charged, or if no input is detected, as well as whether the USB power is valid.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Charger24

Example Key Functions

Application Init

Initializes the logger and the Charger 24 Click driver and enables charging while disabling boost mode.

void application_init ( void )
{
log_cfg_t log_cfg;
charger24_cfg_t charger24_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
charger24_cfg_setup( &charger24_cfg );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == charger24_init( &charger24, &charger24_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
charger24_disable_boost ( &charger24 );
charger24_enable_charging ( &charger24 );
log_info( &logger, " Application Task " );
}
#define CHARGER24_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition charger24.h:92
void charger24_disable_boost(charger24_t *ctx)
Charger 24 disable boost function.
void application_init(void)
Definition main.c:39
#define MIKROBUS_POSITION_CHARGER24
Definition main.c:33

Application Task

Periodically reads and logs the charging and USB power status.

void application_task ( void )
{
uint8_t status = charger24_get_status ( &charger24 );
log_printf( &logger, "\r\n Charging status: " );
switch ( status )
{
{
log_printf( &logger, "No input or fault\r\n" );
break;
}
{
log_printf( &logger, "Trickle, precharge, fast charge\r\n" );
break;
}
{
log_printf( &logger, "Top-off and done\r\n" );
break;
}
default:
{
log_printf( &logger, "Unknown\r\n" );
break;
}
}
log_printf( &logger, " USB status: " );
if ( charger24_get_iok_pin( &charger24 ) )
{
log_printf( &logger, "No power\r\n" );
}
else
{
log_printf( &logger, "Power good\r\n" );
}
}
#define CHARGER24_STATE_CHARGING
Definition charger24.h:73
#define CHARGER24_STATE_NO_INPUT
Charger 24 charging state setting.
Definition charger24.h:72
#define CHARGER24_STATE_CHARGE_DONE
Definition charger24.h:74
void application_task(void)
Definition main.c:72

Note

Ensure a valid USB input source and battery are connected to observe status transitions.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.